import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'

export default defineConfig({
    plugins: [vue()],
    resolve: {
        alias: {
            '@': path.resolve(__dirname, 'src')
        }
    },
    server: {
        proxy: {
            '/api': {
                target: 'http://localhost:8080',
                changeOrigin: true,
                rewrite: (path) => path.replace(/^\/api/, '') // 确保这里正确去掉了 /api 前缀
            }
            ,
            '/upload_video': {
                target: 'http://localhost:5000',
                changeOrigin: true,
                secure: false
              },
              '/video_feed': {
                target: 'http://localhost:5000',
                changeOrigin: true,
                secure: false
              },
              '/camera_feed': {
                target: 'http://localhost:5000',
                changeOrigin: true,
                secure: false
              }
        }
    },
    define: {
        __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: false
    }
})
